package org.example;

import java.util.ArrayList;
import java.util.List;

public class Test1 {
    //leetcode 77 组合 https://leetcode.cn/problems/combinations/description/
    public List<List<Integer>> ret;
    public int m,count;
    public List<List<Integer>> combine(int n, int k) {
        ret = new ArrayList<>();
        m = n;
        count = k;
        backtracking(1,new ArrayList<>());
        return ret;
    }

    public void backtracking(int start,List<Integer> list) {
        if (list.size() == count) {
            ret.add(new ArrayList<>(list));
            return;
        }
        for (int i = start; i <= m; i++) {
            list.add(i);
            backtracking(i + 1,list);
            list.remove(list.size() - 1);
        }
    }

    public static void main(String[] args) {
        Test1 test1 = new Test1();
        test1.combine(4,2);
        System.out.println(666);
    }
}
